<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>新闻管理</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="css/mangerNews.css">
    <script src="js/update.js" language="javascript" type="text/javascript"></script>

  </head>
  
  <body style="height:950px;">
   <div class="Top_1">
	    <div class="Topz_1">
	     <img src="image/logn.jpg"/>
	    </div>
	    <div class="Topz_2">
	     <img src="image/logo5.jpg"/>
	    </div>
   </div>
   <div class="DaoHang">
	   <ul>
	   <li name="daoh"style="letter-spacing:15px;"><a href="main.jsp">首页</a></li>
	   <li name="daoh"><a   href="aboutBluemsun.jsp">关于蓝旭</a>
	   <li style="background:url(image/dh_02.png);"name="daohX"><a   href="mafx?flag=mangerNews&pagenow=1&pagesize=17">新闻管理</a></li>
	   <li name="daoh"><a   href="">用户信息</a></li>
	   <li name="daoh"><a   href="mfx?flag=selectBluemsunM">蓝旭出品</a></li>
	   <li name="daoh"><a   href="">关于我们</a></li>
	   </ul>
   </div>
 <div class="center_1">
    <ul  id="addNews">
	    <li>
	       <a href="mafx?flag=selectImage">添加新闻》》</a>
	    </li>
    </ul>
    <table id="table">
    <tr>
	    <td>ID号</td>
	    <td>题目</td>
	    <td>类型</td>
	    <td>发布者</td>
	    <td>发布日期</td>
	    <td>修改新闻</td>
	    <td>删除新闻</td>
    </tr>
    <c:forEach items="${newsList}" var="newso"> 
        <tr> 
        <td><input name="${newso.id}"class="tm"size=4 type="text" value="${newso.id}"/></td>
	    <td><input name="${newso.id}"class="tm tleft"type="text" value="${newso.title}"/></td>
	    <td><input name="${newso.id}"class="tm tleft"type="text" value="${newso.type}"/></td>
	    <td><input name="${newso.id}"class="tm tleft"type="text" value="${newso.maker}"/></td>
	    <td><input name="${newso.id}"class="tm"type="text" value="${newso.date}"/></td>
	    <td><input  class="update"type="button"onclick="show(${newso.id});"value="修改"/></td>
	    <td><a onclick="return ifDel();"style="color:yellow;"href="mafx?flag=delete&id=${newso.id }">删除</a></td>
	    </tr>
    </c:forEach>
    </table>
 </div>
 <div id="hide">
 <img id="img"onmouseover="changeImgTo2();"onmouseout="changeImgTo1();"onclick="show(1);"src="image/gb.jpg" width="20px"height="20px">
	 <table id="table2">
		 <form action="mafx?flag=update"method="post">
		    <tr><td>ID号：</td><td><input class="update_1" readonly="readonly"type="text" name="id"/></td></tr>
		    <tr> <td>题目：</td><td><input class="update_1" type="text" name="title"/></td></tr>
		    <tr> <td>类型：</td><td><input class="update_1" type="text" name="type"/></td></tr>
		    <tr> <td>发布者：</td><td><input class="update_1" type="text" name="maker"></td></tr>
		    <tr> <td>发布日期：</td><td><input class="update_1" style="width:175px;" type="text" name="date"/></td></tr>
		    <tr> <td><input type="submit" value="修改"/></td><td><input type="reset" value="重置"/></td></tr>
		 </form>
	 </table>
 </div>
 <div class="bottom_1">
		<li id="li">
			<font>分页导航:&nbsp;</font>&nbsp;&nbsp;
			<%!
			int pageCount=0;
			int pageNow=1;
			%>
			<%
			int rowCount=Integer.parseInt(request.getParameter("rowCount"));
			if(request.getParameter("pageCount")!=null&&request.getParameter("pageNow")!=null){
			   pageCount=Integer.parseInt(request.getParameter("pageCount"));
			   pageNow=Integer.parseInt(request.getParameter("pageNow"));
			   out.print("总共"+rowCount+"条记录　");  
			if (pageCount>1){  
			   out.print("当前第"+pageNow+"页　");  
			   out.print("共"+pageCount+"页　");}  
			if(pageNow!=1) {  
			        out.print("<a href=mafx?pagesize=17&pagenow=1&flag=mangerNews>首页</a>　");  
			        out.print("<a href=mafx?pagesize=17&flag=mangerNews&pagenow="+(pageNow-1)+">上一页</a>　");  
			}  
			if(pageNow!=pageCount){  
			    out.print("<a href=mafx?pagesize=17&flag=mangerNews&pagenow="+(pageNow+1)+">下一页</a>　");  
			    out.print("<a href=mafx?pagesize=17&flag=mangerNews&pagenow="+pageCount+">尾页</a>　");  
			} 
			}
			%> 
		</li> 
 </div>
  </body>
</html>
